Online PHP Function(s){ #Test PHP functions online!; }

  •  
 

 
Added: 08/12/2012 by John

Create SSH key pair to login without password

You can setup SSH so you can login without having to use a password. This can be great if you use SSHFS, a script that needs access to another server, or if you need to login to a server many times and don't want to enter the password every time you login.

Step 1 - Create a key

First you need to create a key on the client.

Default method:
ssh-keygen

More secure:
ssh-keygen -t rsa -b 4096


Step 2 - Copy the key to the server

ssh-copy-id '-p 22 -i /home/username/.ssh/id_rsa username@servername.net'


If your distro does not have 'ssh-copy-id' use this:
ssh-keygen -t rsa
ssh username@servername.net -p22 "mkdir .ssh; chmod 0700 .ssh"
scp -P 22 ~/.ssh/id_rsa.pub username@servername.net:
ssh username@servername.net -p22 "cat id_rsa.pub >> ~/.ssh/authorized_keys"


Step 3 - Check if it works!

ssh username@servername.net -p22


That's it! You should be logged in without typing in a password.


 

 

 


Comments

 
 
      © 2019 OnlinePHPFunctions.com | Disclaimer |       PHP versions: 7.2.4, 7.1.0, 7.0.14, 7.0.5, 7.0.4, 7.0.3, 7.0.2, 7.0.1, 5.6.29, 5.6.20, 5.6.19, 5.6.18, 5.6.17, 5.6.2, 5.5.34, 5.5.33, 5.5.32, 5.5.31, 5.5.18, 5.5.5, 5.5.0.a6, 5.5.0.a.5, 5.5.0.a.2, 5.4.34, 5.4.21, 5.4.13, 5.4.12, 5.4.11, 5.4.10, 5.4.9, 5.4.8, 5.4.7, 5.4.6, 5.4.5, 5.4.4, 5.4.3, 5.4.2, 5.4.1, 5.4.0, 5.3.29, 5.3.27, 5.3.23, 5.3.22, 5.3.21, 5.3.20, 5.3.19, 5.3.18, 5.3.17, 5.3.16, 5.3.15, 5.3.14, 5.3.13, 5.3.12, 5.3.11, 5.3.10, 5.3.2, 5.3.1, 5.3.0, 5.2.17, 5.2.16, 5.1.6, 5.1.5, 5.0.5, 5.0.4, 4.4.9